<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
</style>

<body>
  <h1>我是H5文字</h1>

  <button>我来调用鸿蒙的方法</button>
</body>
<script>
  // 声明一个方法给鸿蒙调用
  function JSFU(val) {
    document.querySelector('h1').innerHTML = val
    return {
      code: 200,
      id: val
    }
  }

  // 声明一个函数来给 鸿蒙 注入
  document.querySelector('button').onclick = () => {
    if (h5ObjName && h5ObjName.h5ObjKey) h5ObjName.h5ObjKey(Date.now() + '')
  }

</script>

</html>